﻿@page "/bubbleSimple"

<h3>Bubble Simple</h3>

<Chart Config="_config1" @ref="_chart1" Height="400px"></Chart>

<hr />

<h3>Code</h3>

<p>
    This is the component to add in your page.
</p>

<CodeSnippet Language="Language.xml" Style="Style.VisualStudio">
&ltChart Config="_config1" &#64;ref="_chart1">&lt;Chart>
</CodeSnippet>

<p>
    Then, in the code section, add the following code:
</p>

<CodeSnippet Language="Language.csharp" Style="Style.VisualStudio" LoadMainScript="false">
private BubbleChartConfig? _config1;
private Chart? _chart1;

protected override async Task OnInitializedAsync()
{
    _config1 = new BubbleChartConfig()
        {
        };

    _config1.Data.Labels = BubbleDataExamples.SimpleBubbleText;
    _config1.Data.Datasets.Add(new BubbleDataset()
        {
            Label = "My First Dataset",
            Data = BubbleDataExamples.SimpleBubble,
            BackgroundColor = Colors.PaletteBorder1.FirstOrDefault()
        });
}
</CodeSnippet>

@code {
    private BubbleChartConfig? _config1;
    private Chart? _chart1;

    protected override async Task OnInitializedAsync()
    {
        _config1 = new BubbleChartConfig()
        {
            Options = new Options()
            {
                 Responsive = true,
                 MaintainAspectRatio = false
            }
        };

        _config1.Data.Labels = BubbleDataExamples.SimpleBubbleText;
        _config1.Data.Datasets.Add(new BubbleDataset()
            {
                Label = "My First Dataset",
                Data = BubbleDataExamples.SimpleBubble,
                BackgroundColor = Colors.PaletteBorder1.FirstOrDefault()
            });
    }
}
